<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script type="text/javascript">

    function addTreat(clinicId, patientId) {
        var selectedTr = $("#applyTable .table-selected").find("td").eq(0).find("input").val();
        if (selectedTr == "undefined" || selectedTr == undefined) {
            toastr.info("请先选择一条模板，再插入！");
        } else {
            parentDivLoad('rigthDoctorCenterDiv', 'inputForm2','${ctx}/doctor/clinicRecord/index?patientId=' + patientId + '&clinicId=' + clinicId,'${ctx}/doctor/clinicRecord/saveRecord?patientIdVal='+patientId+'&clinicId='+clinicId);
        }
    }

    function addSubProjectDivN(tr,showDiv, url) {
        $(tr).each(function(i,e){
            $(this).parent().find("tr").removeClass("table-selected");
            $(this).addClass("table-selected");
//            }
        })
        loadDiv(showDiv, url);
//        $("#itemTableList").treeTable({expandLevel: 2});
    }


</script>
<form id="addForm">

</form>
<div class="panel-body">
    <section class="main-content col-lg-12" id="LeftDiv">
        <div class="table-responsive no-border">
            <div class="datatable-top">
                <div class="pull-left">
                    <%--<form:form id="searchForm" modelAttribute="doctorTempla"  onsubmit="return loadDivForm('mainCenterDiv','searchFormDict','${ctx}/template/doctorTempla/index');" method="post" class="form-inline">--%>
                    <%--<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>--%>
                    <%--<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>--%>
                    <%--<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>--%>
                    <%--</form:form>--%>
                    <input class="btn btn-new" onclick="addTreat('${clinicId}','${patientId}')" type="button" value="插入"
                           id="addClinic"/>
                </div>
            </div>
            <table id="applyTable" class="table table-bordered mg-t datatable">
                <thead>
                <tr>

                    <th>序号</th>
                    <th>主题</th>
                    <th>子标题</th>
                    <th>范围</th>
                    <th>科室</th>
                    <th>类型</th>
                    <th>诊断描述</th>
                    <th>建议</th>
                    <th>创建人</th>
                    <th style="display:none">id</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${pageApply}" var="doctorTempla" varStatus="count">
                <tr onclick="addSubProjectDivN(this,'treatProjectItem','${ctx}/doctor/outpTreatRec/indexTreatSub?type=3&id=${doctorTempla.id}')">
                    <td><input type="hidden" value="${doctorTempla.id}"> ${count.index+1}</td>
                    <td> ${doctorTempla.title}</td>
                    <td> ${doctorTempla.subTitle}</td>
                    <td> ${fns:getDictLabels(doctorTempla.flag, 'TEMPLA_FLAG', '')}</td>
                    <td> ${fns:getDeptName(doctorTempla.deptCode,'')}</td>
                    <td> ${fns:getDictLabels(doctorTempla.projectType,'TEMPLA_GENRE','')}</td>
                    <td> ${doctorTempla.advice}</td>
                    <td> ${doctorTempla.diagnosis}</td>
                    <td> ${doctorTempla.name}</td>
                    <td style="display:none"></td>
                </tr>
                </c:forEach>

            </table>
            <div class="pagination">${page}</div>
        </div>
    </section>
</div>

